<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>Document</title>
    <style>
        .mycomponent{
            width: 160px;
            border: solid 1px #ccc;
            display: flex;
        }

        .mycomponent button{
            flex: 1;
        }
    </style>
</head>
<body>
    <div id="app">
        <my-component btn-name="+"></my-component>
    </div>

    <script>

        Vue.component("my-component",{
            props:["btnName"],
            template :
            `<div class="mycomponent">
                <button @click="increase">{{btnName}}</button>
                <p>{{num}}</p>
                <button @click="decrease">-</button>
            </div>
            `,
            data(){
                return {
                    num:0
                }
            },
            methods:{
                increase(){
                    this.num++
                },
                decrease(){
                    this.num--
                }
            }
        })

        new Vue({
            el:"#app"
        })

        
    </script>
</body>
</html>